
package demo02;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class Poker2 {
    public static void main(String[] args) {
        String[] number = {"2", "A", "K", "Q", "J", "10", "9", "8", "7", "6", "5", "4", "3"};
        String[] color = {"黑桃", "梅花", "红桃", "方块"};
        ArrayList<String> list = new ArrayList<>();
        for (String s : color) {
            for (String s1 : number) {

                list.add(s + s1);
            }

        }
        list.add("大王");
        list.add("小王");
        Collections.shuffle(list);
        Random r = new Random();
        int in = r.nextInt(55);
        //发牌
        ArrayList<String> 老大 = new ArrayList<>();
        ArrayList<String> 老二 = new ArrayList<>();
        ArrayList<String> 老么 = new ArrayList<>();
        ArrayList<String> 底牌 = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            String s = list.get(i);
            if (i >= 51) {
                底牌.add(s);
            } else if (i % 3 == 0&i==in) {
                老大.add(s);
                老大.addAll(底牌);
            } else if (i % 3 == 1&i==in) {
                老二.add(s);
                老二.addAll(底牌);
            } else if (i % 3 == 2&i==in) {
                老么.add(s);
                老么.addAll(底牌);
            }
        }
        System.out.println("老大 " + 老大);
        System.out.println("老二 " + 老二);
        System.out.println("老么 " + 老么);


    }
}


